/*
 * This file is part of qmsystem-qml-example package
 *
 * Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to 
 * deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,     
 * and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER  
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS  
 * IN THE SOFTWARE. 
 */

import QtQuick 1.1
import com.nokia.meego 1.0

import com.nokia.platformapiexamples 1.0

Page {
    Item {
        anchors.fill: parent

        QmSystemExample {
            id: qmSystems
        }

        PageHeader {
            id: pageTitle

            height: parent.width < parent.height ? UiConstants.HeaderDefaultHeightPortrait : UiConstants.HeaderDefaultHeightLandscape
            width: parent.width
            text: "QmSystem Example"
        }


        Item {
            id: bodyText
            anchors { top: pageTitle.bottom; bottom: parent.bottom; left: parent.left; right: parent.right; margins: UiConstants.DefaultMargin }

            //! Defining scrollable area
            Flickable {
                id: bodyFlick
                anchors.fill: parent
                contentHeight: dataCol.height

                Item {
                    anchors.top: parent.top

                    Column {
                        id: dataCol
                        spacing: 16

                        //! Display release version
                        Column {
                            spacing: 5

                            Label {
                                text: "Release version"
                                font {  weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.releaseVersion
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Display device mode
                        Column {
                            spacing: 5

                            Label {
                                text: "Device mode"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.deviceMode
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Display remaining charging time
                        Column {
                            spacing: 5

                            Label {
                                text: "Remaining talk time"
                                font {  weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                /*!
                                 * Function remainingTalkTime returns results in seconds. To display it in minutes result is divided by 60.
                                 * toFixed(0) formats number in a way to show only whole number.
                                 */
                                text: qmSystems.remainingTalkTime > -1 ? (qmSystems.remainingTalkTime/60).toFixed(0) + " minutes": "Not Available"
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }


                        //! Display remaining active use time
                        Column {
                            spacing: 5

                            Label {
                                text: "Remaining active use time"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.remainingActiveTime > -1 ? (qmSystems.remainingActiveTime/60).toFixed(0) + " minutes": "Not Available"
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Display remaining idle time
                        Column {
                            spacing: 5

                            Label {
                                text: "Remaining idle time"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.remainingIdleTime > -1 ? (qmSystems.remainingIdleTime/60).toFixed(0) + " minutes": "Not Available"
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Show system time status
                        Column {
                            spacing: 5

                            Label {
                                text: "System time status"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.autoSystemTime
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Show time zone status
                        Column {
                            spacing: 5

                            Label {
                                text: "Time zone status"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.autoTimeZone
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Show current time zone
                        Column {
                            spacing: 5

                            Label {
                                text: "Current time zone"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.timezone
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Show automatically guessed time zone
                        Column {
                            spacing: 5

                            Label {
                                text: "Automatically guessed time zone"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.timezoneAuto
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Show time updates from operator
                        Column {
                            spacing: 5

                            Label {
                                text: "Time updates from operator"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.timeFromOperator
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                        //! Show default time zone from manufacture
                        Column {
                            spacing: 5

                            Label {
                                text: "Default time zone from manufacture"
                                font { weight: Font.Bold; pixelSize: 26 /* 26 px */ }
                            }
                            Label {
                                text: qmSystems.defaultTimeZone
                                font { weight: Font.Light; pixelSize: 22 /* 22 px */ }
                                color: UiConstants.FieldLabelColor
                            }
                        }

                    }
                }
            }

            //! Scroll decorator for the flickable area
            ScrollDecorator {
                flickableItem: bodyFlick
            }
        }
    }
}
